const NAIF_IDS = Dict{String, Int}(
    "SOLAR_SYSTEM_BARYCENTER" => 0,
    "SSB"                     => 0,
    "SOLAR SYSTEM BARYCENTER" => 0,
    "MERCURY_BARYCENTER"      => 1,
    "MERCURY BARYCENTER"      => 1,
    "VENUS_BARYCENTER"        => 2,
    "VENUS BARYCENTER"        => 2,
    "EARTH_BARYCENTER"        => 3,
    "EMB"                     => 3,
    "EARTH MOON BARYCENTER"   => 3,
    "EARTH-MOON BARYCENTER"   => 3,
    "EARTH BARYCENTER"        => 3,
    "MARS_BARYCENTER"         => 4,
    "MARS BARYCENTER"         => 4,
    "JUPITER_BARYCENTER"      => 5,
    "JUPITER BARYCENTER"      => 5,
    "SATURN_BARYCENTER"       => 6,
    "SATURN BARYCENTER"       => 6,
    "URANUS_BARYCENTER"       => 7,
    "URANUS BARYCENTER"       => 7,
    "NEPTUNE_BARYCENTER"      => 8,
    "NEPTUNE BARYCENTER"      => 8,
    "PLUTO_BARYCENTER"        => 9,
    "PLUTO BARYCENTER"        => 9,
    "SUN"                     => 10,
    "MERCURY"    => 199,
    "VENUS"      => 299,
    "EARTH"      => 399,
    "MOON"       => 301,
    "MARS"       => 499,
    "PHOBOS"     => 401,
    "DEIMOS"     => 402,
    "JUPITER"    => 599,
    "IO"         => 501,
    "EUROPA"     => 502,
    "GANYMEDE"   => 503,
    "CALLISTO"   => 504,
    "AMALTHEA"   => 505,
    "HIMALIA"    => 506,
    "ELARA"      => 507,
    "PASIPHAE"   => 508,
    "SINOPE"     => 509,
    "LYSITHEA"   => 510,
    "CARME"      => 511,
    "ANANKE"     => 512,
    "LEDA"       => 513,
    "THEBE"      => 514,
    "ADRASTEA"   => 515,
    "METIS"      => 516,
    "CALLIRRHOE" => 517,
    "THEMISTO"   => 518,
    "MAGACLITE"  => 519,
    "TAYGETE"    => 520,
    "CHALDENE"   => 521,
    "HARPALYKE"  => 522,
    "KALYKE"     => 523,
    "IOCASTE"    => 524,
    "ERINOME"    => 525,
    "ISONOE"     => 526,
    "PRAXIDIKE"  => 527,
    "AUTONOE"    => 528,
    "THYONE"     => 529,
    "HERMIPPE"   => 530,
    "AITNE"      => 531,
    "EURYDOME"   => 532,
    "EUANTHE"    => 533,
    "EUPORIE"    => 534,
    "ORTHOSIE"   => 535,
    "SPONDE"     => 536,
    "KALE"       => 537,
    "PASITHEE"   => 538,
    "HEGEMONE"   => 539,
    "MNEME"      => 540,
    "AOEDE"      => 541,
    "THELXINOE"  => 542,
    "ARCHE"      => 543,
    "KALLICHORE" => 544,
    "HELIKE"     => 545,
    "CARPO"      => 546,
    "EUKELADE"   => 547,
    "CYLLENE"    => 548,
    "KORE"       => 549,
    "HERSE"      => 550,
    "SATURN"     => 699,
    "MIMAS"      => 601,
    "ENCELADUS"  => 602,
    "TETHYS"     => 603,
    "DIONE"      => 604,
    "RHEA"       => 605,
    "TITAN"      => 606,
    "HYPERION"   => 607,
    "IAPETUS"    => 608,
    "PHOEBE"     => 609,
    "JANUS"      => 610,
    "EPIMETHEUS" => 611,
    "HELENE"     => 612,
    "TELESTO"    => 613,
    "CALYPSO"    => 614,
    "ATLAS"      => 615,
    "PROMETHEUS" => 616,
    "PANDORA"    => 617,
    "PAN"        => 618,
    "YMIR"       => 619,
    "PAALIAQ"    => 620,
    "TARVOS"     => 621,
    "IJIRAQ"     => 622,
    "SUTTUNGR"   => 623,
    "KIVIUQ"     => 624,
    "MUNDILFARI" => 625,
    "ALBIORIX"   => 626,
    "SKATHI"     => 627,
    "ERRIAPUS"   => 628,
    "SIARNAQ"    => 629,
    "THRYMR"     => 630,
    "NARVI"      => 631,
    "METHONE"    => 632,
    "PALLENE"    => 633,
    "POLYDEUCES" => 634,
    "DAPHNIS"    => 635,
    "AEGIR"      => 636,
    "BEBHIONN"   => 637,
    "BERGELMIR"  => 638,
    "BESTLA"     => 639,
    "FARBAUTI"   => 640,
    "FENRIR"     => 641,
    "FORNJOT"    => 642,
    "HATI"       => 643,
    "HYRROKKIN"  => 644,
    "KARI"       => 645,
    "LOGE"       => 646,
    "SKOLL"      => 647,
    "SURTUR"     => 648,
    "ANTHE"      => 649,
    "JARNSAXA"   => 650,
    "GREIP"      => 651,
    "TARQEQ"     => 652,
    "AEGAEON"    => 653,
    "URANUS"     => 799,
    "ARIEL"      => 701,
    "UMBRIEL"    => 702,
    "TITANIA"    => 703,
    "OBERON"     => 704,
    "MIRANDA"    => 705,
    "CORDELIA"   => 706,
    "OPHELIA"    => 707,
    "BIANCA"     => 708,
    "CRESSIDA"   => 709,
    "DESDEMONA"  => 710,
    "JULIET"     => 711,
    "PORTIA"     => 712,
    "ROSALIND"   => 713,
    "BELINDA"    => 714,
    "PUCK"       => 715,
    "CALIBAN"    => 716,
    "SYCORAX"    => 717,
    "PROSPERO"   => 718,
    "SETEBOS"    => 719,
    "STEPHANO"   => 720,
    "TRINCULO"   => 721,
    "FRANCISCO"  => 722,
    "MARGARET"   => 723,
    "FERDINAND"  => 724,
    "PERDITA"    => 725,
    "MAB"        => 726,
    "CUPID"      => 727,
    "NEPTUNE"    => 899,
    "TRITON"     => 801,
    "NEREID"     => 802,
    "NAIAD"      => 803,
    "THALASSA"   => 804,
    "DESPINA"    => 805,
    "GALATEA"    => 806,
    "LARISSA"    => 807,
    "PROTEUS"    => 808,
    "HALIMEDE"   => 809,
    "PSAMATHE"   => 810,
    "SAO"        => 811,
    "LAOMEDEIA"  => 812,
    "NESO"       => 813,
    "PLUTO"      => 999,
    "CHARON"     => 901,
    "NIX"        => 902,
    "HYDRA"      => 903,
    "KERBEROS"   => 904,
    "STYX"       => 905,
    "GEOTAIL"                             => -1,
    "MOM"                                 => -3,
    "MARS ORBITER MISSION"                => -3,
    "AKATSUKI"                            => -5,
    "VCO"                                 => -5,
    "PLC"                                 => -5,
    "PLANET-C"                            => -5,
    "P6"                                  => -6,
    "PIONEER-6"                           => -6,
    "P7"                                  => -7,
    "PIONEER-7"                           => -7,
    "WIND"                                => -8,
    "VENUS ORBITER"                       => -12,
    "P12"                                 => -12,
    "PIONEER 12"                          => -12,
    "LADEE"                               => -12,
    "POLAR"                               => -13,
    "MGN"                                 => -18,
    "MAGELLAN"                            => -18,
    "LCROSS"                              => -18,
    "P8"                                  => -20,
    "PIONEER-8"                           => -20,
    "SOHO"                                => -21,
    "P10"                                 => -23,
    "PIONEER-10"                          => -23,
    "P11"                                 => -24,
    "PIONEER-11"                          => -24,
    "LP"                                  => -25,
    "LUNAR PROSPECTOR"                    => -25,
    "VK1"                                 => -27,
    "VIKING 1 ORBITER"                    => -27,
    "STARDUST"                            => -29,
    "SDU"                                 => -29,
    "NEXT"                                => -29,
    "VK2"                                 => -30,
    "VIKING 2 ORBITER"                    => -30,
    "DS-1"                                => -30,
    "VG1"                                 => -31,
    "VOYAGER 1"                           => -31,
    "VG2"                                 => -32,
    "VOYAGER 2"                           => -32,
    "CLEMENTINE"                          => -40,
    "MEX"                                 => -41,
    "MARS EXPRESS"                        => -41,
    "BEAGLE2"                             => -44,
    "BEAGLE 2"                            => -44,
    "MS-T5"                               => -46,
    "SAKIGAKE"                            => -46,
    "PLANET-A"                            => -47,
    "SUISEI"                              => -47,
    "GNS"                                 => -47,
    "GENESIS"                             => -47,
    "HUBBLE SPACE TELESCOPE"              => -48,
    "HST"                                 => -48,
    "MARS PATHFINDER"                     => -53,
    "MPF"                                 => -53,
    "MARS ODYSSEY"                        => -53,
    "MARS SURVEYOR 01 ORBITER"            => -53,
    "ARM"                                 => -54,
    "ASTEROID RETRIEVAL MISSION"          => -54,
    "ULYSSES"                             => -55,
    "VSOP"                                => -58,
    "HALCA"                               => -58,
    "RADIOASTRON"                         => -59,
    "JUNO"                                => -61,
    "ORX"                                 => -64,
    "OSIRIS-REX"                          => -64,
    "VEGA 1"                              => -66,
    "VEGA 2"                              => -67,
    "MMO"                                 => -68,
    "MERCURY MAGNETOSPHERIC ORBITER"      => -68,
    "MPO"                                 => -69,
    "MERCURY PLANETARY ORBITER"           => -69,
    "DEEP IMPACT IMPACTOR SPACECRAFT"     => -70,
    "MRO"                                 => -74,
    "MARS RECON ORBITER"                  => -74,
    "MSL"                                 => -76,
    "MARS SCIENCE LABORATORY"             => -76,
    "GLL"                                 => -77,
    "GALILEO ORBITER"                     => -77,
    "GIOTTO"                              => -78,
    "SPITZER"                             => -79,
    "SPACE INFRARED TELESCOPE FACILITY"   => -79,
    "SIRTF"                               => -79,
    "CASSINI ITL"                         => -81,
    "CAS"                                 => -82,
    "CASSINI"                             => -82,
    "PHOENIX"                             => -84,
    "LRO"                                 => -85,
    "LUNAR RECON ORBITER"                 => -85,
    "LUNAR RECONNAISSANCE ORBITER"        => -85,
    "CH1"                                 => -86,
    "CHANDRAYAAN-1"                       => -86,
    "CASSINI SIMULATION"                  => -90,
    "NEAR EARTH ASTEROID RENDEZVOUS"      => -93,
    "NEAR"                                => -93,
    "MO"                                  => -94,
    "MARS OBSERVER"                       => -94,
    "MGS"                                 => -94,
    "MARS GLOBAL SURVEYOR"                => -94,
    "MGS SIMULATION"                      => -95,
    "SPP"                                 => -96,
    "SOLAR PROBE PLUS"                    => -96,
    "TOPEX/POSEIDON"                      => -97,
    "NEW HORIZONS"                        => -98,
    "TROPICAL RAINFALL MEASURING MISSION" => -107,
    "TRMM"                                => -107,
    "ICE"                                 => -112,
    "MARS POLAR LANDER"                   => -116,
    "MPL"                                 => -116,
    "BEPICOLOMBO"                         => -121,
    "MARS CLIMATE ORBITER"                => -127,
    "MCO"                                 => -127,
    "MUSES-C"                             => -130,
    "HAYABUSA"                            => -130,
    "SELENE"                              => -131,
    "KAGUYA"                              => -131,
    "DRTS-W"                              => -135,
    "EPOCH"                               => -140,
    "DIXI"                                => -140,
    "EPOXI"                               => -140,
    "DEEP IMPACT FLYBY SPACECRAFT"        => -140,
    "TERRA"                               => -142,
    "EOS-AM1"                             => -142,
    "SOLO"                                => -144,
    "SOLAR ORBITER"                       => -144,
    "LUNAR-A"                             => -146,
    "CASSINI PROBE"                       => -150,
    "HUYGENS PROBE"                       => -150,
    "CASP"                                => -150,
    "AXAF"                                => -151,
    "CHANDRA"                             => -151,
    "AQUA"                                => -154,
    "EUROPA ORBITER"                      => -159,
    "YOHKOH"                              => -164,
    "SOLAR-A"                             => -164,
    "MAP"                                 => -165,
    "IMAGE"                               => -166,
    "JWST"                                => -170,
    "JAMES WEBB SPACE TELESCOPE"          => -170,
    "GRAIL-A"                             => -177,
    "PLANET-B"                            => -178,
    "NOZOMI"                              => -178,
    "GRAIL-B"                             => -181,
    "CLUSTER 1"                           => -183,
    "CLUSTER 2"                           => -185,
    "MUSES-B"                             => -188,
    "NSYT"                                => -189,
    "INSIGHT"                             => -189,
    "SIM"                                 => -190,
    "CLUSTER 3"                           => -194,
    "CLUSTER 4"                           => -196,
    "INTEGRAL"                            => -198,
    "CONTOUR"                             => -200,
    "MAVEN"                               => -202,
    "DAWN"                                => -203,
    "SOIL MOISTURE ACTIVE AND PASSIVE"    => -205,
    "SMAP"                                => -205,
    "STV51"                               => -212,
    "STV52"                               => -213,
    "STV53"                               => -214,
    "ROSETTA"                             => -226,
    "KEPLER"                              => -227,
    "GLL PROBE"                           => -228,
    "GALILEO PROBE"                       => -228,
    "STEREO AHEAD"                        => -234,
    "STEREO BEHIND"                       => -235,
    "MESSENGER"                           => -236,
    "SMART1"                              => -238,
    "SM1"                                 => -238,
    "S1"                                  => -238,
    "SMART-1"                             => -238,
    "VEX"                                 => -248,
    "VENUS EXPRESS"                       => -248,
    "OPPORTUNITY"                         => -253,
    "MER-1"                               => -253,
    "SPIRIT"                              => -254,
    "MER-2"                               => -254,
    "RADIATION BELT STORM PROBE A"        => -362,
    "RBSP_A"                              => -362,
    "RADIATION BELT STORM PROBE B"        => -363,
    "RBSP_B"                              => -363,
    "RSAT"                                => -500,
    "SELENE Relay Satellite"              => -500,
    "SELENE Rstar"                        => -500,
    "Rstar"                               => -500,
    "VSAT"                                => -502,
    "SELENE VLBI Radio Satellite"         => -502,
    "SELENE VRAD Satellite"               => -502,
    "SELENE Vstar"                        => -502,
    "Vstar"                               => -502,
    "MARS-96"                             => -550,
    "M96"                                 => -550,
    "MARS 96"                             => -550,
    "MARS96"                              => -550,
    "SPRINT-A"                            => -750,
    "AREND"                               => 1000001,
    "AREND-RIGAUX"                        => 1000002,
    "ASHBROOK-JACKSON"                    => 1000003,
    "BOETHIN"                             => 1000004,
    "BORRELLY"                            => 1000005,
    "BOWELL-SKIFF"                        => 1000006,
    "BRADFIELD"                           => 1000007,
    "BROOKS 2"                            => 1000008,
    "BRORSEN-METCALF"                     => 1000009,
    "BUS"                                 => 1000010,
    "CHERNYKH"                            => 1000011,
    "67P/CHURYUMOV-GERASIMENKO (1969 R1)" => 1000012,
    "CHURYUMOV-GERASIMENKO"               => 1000012,
    "CIFFREO"                             => 1000013,
    "CLARK"                               => 1000014,
    "COMAS SOLA"                          => 1000015,
    "CROMMELIN"                           => 1000016,
    "D'ARREST"                            => 1000017,
    "DANIEL"                              => 1000018,
    "DE VICO-SWIFT"                       => 1000019,
    "DENNING-FUJIKAWA"                    => 1000020,
    "DU TOIT 1"                           => 1000021,
    "DU TOIT-HARTLEY"                     => 1000022,
    "DUTOIT-NEUJMIN-DELPORTE"             => 1000023,
    "DUBIAGO"                             => 1000024,
    "ENCKE"                               => 1000025,
    "FAYE"                                => 1000026,
    "FINLAY"                              => 1000027,
    "FORBES"                              => 1000028,
    "GEHRELS 1"                           => 1000029,
    "GEHRELS 2"                           => 1000030,
    "GEHRELS 3"                           => 1000031,
    "GIACOBINI-ZINNER"                    => 1000032,
    "GICLAS"                              => 1000033,
    "GRIGG-SKJELLERUP"                    => 1000034,
    "GUNN"                                => 1000035,
    "HALLEY"                              => 1000036,
    "HANEDA-CAMPOS"                       => 1000037,
    "HARRINGTON"                          => 1000038,
    "HARRINGTON-ABELL"                    => 1000039,
    "HARTLEY 1"                           => 1000040,
    "HARTLEY 2"                           => 1000041,
    "HARTLEY-IRAS"                        => 1000042,
    "HERSCHEL-RIGOLLET"                   => 1000043,
    "HOLMES"                              => 1000044,
    "HONDA-MRKOS-PAJDUSAKOVA"             => 1000045,
    "HOWELL"                              => 1000046,
    "IRAS"                                => 1000047,
    "JACKSON-NEUJMIN"                     => 1000048,
    "JOHNSON"                             => 1000049,
    "KEARNS-KWEE"                         => 1000050,
    "KLEMOLA"                             => 1000051,
    "KOHOUTEK"                            => 1000052,
    "KOJIMA"                              => 1000053,
    "KOPFF"                               => 1000054,
    "KOWAL 1"                             => 1000055,
    "KOWAL 2"                             => 1000056,
    "KOWAL-MRKOS"                         => 1000057,
    "KOWAL-VAVROVA"                       => 1000058,
    "LONGMORE"                            => 1000059,
    "LOVAS 1"                             => 1000060,
    "MACHHOLZ"                            => 1000061,
    "MAURY"                               => 1000062,
    "NEUJMIN 1"                           => 1000063,
    "NEUJMIN 2"                           => 1000064,
    "NEUJMIN 3"                           => 1000065,
    "OLBERS"                              => 1000066,
    "PETERS-HARTLEY"                      => 1000067,
    "PONS-BROOKS"                         => 1000068,
    "PONS-WINNECKE"                       => 1000069,
    "REINMUTH 1"                          => 1000070,
    "REINMUTH 2"                          => 1000071,
    "RUSSELL 1"                           => 1000072,
    "RUSSELL 2"                           => 1000073,
    "RUSSELL 3"                           => 1000074,
    "RUSSELL 4"                           => 1000075,
    "SANGUIN"                             => 1000076,
    "SCHAUMASSE"                          => 1000077,
    "SCHUSTER"                            => 1000078,
    "SCHWASSMANN-WACHMANN 1"              => 1000079,
    "SCHWASSMANN-WACHMANN 2"              => 1000080,
    "SCHWASSMANN-WACHMANN 3"              => 1000081,
    "SHAJN-SCHALDACH"                     => 1000082,
    "SHOEMAKER 1"                         => 1000083,
    "SHOEMAKER 2"                         => 1000084,
    "SHOEMAKER 3"                         => 1000085,
    "SINGER-BREWSTER"                     => 1000086,
    "SLAUGHTER-BURNHAM"                   => 1000087,
    "SMIRNOVA-CHERNYKH"                   => 1000088,
    "STEPHAN-OTERMA"                      => 1000089,
    "SWIFT-GEHRELS"                       => 1000090,
    "TAKAMIZAWA"                          => 1000091,
    "TAYLOR"                              => 1000092,
    "TEMPEL_1"                            => 1000093,
    "TEMPEL 1"                            => 1000093,
    "TEMPEL 2"                            => 1000094,
    "TEMPEL-TUTTLE"                       => 1000095,
    "TRITTON"                             => 1000096,
    "TSUCHINSHAN 1"                       => 1000097,
    "TSUCHINSHAN 2"                       => 1000098,
    "TUTTLE"                              => 1000099,
    "TUTTLE-GIACOBINI-KRESAK"             => 1000100,
    "VAISALA 1"                           => 1000101,
    "VAN BIESBROECK"                      => 1000102,
    "VAN HOUTEN"                          => 1000103,
    "WEST-KOHOUTEK-IKEMURA"               => 1000104,
    "WHIPPLE"                             => 1000105,
    "WILD 1"                              => 1000106,
    "WILD 2"                              => 1000107,
    "WILD 3"                              => 1000108,
    "WIRTANEN"                            => 1000109,
    "WOLF"                                => 1000110,
    "WOLF-HARRINGTON"                     => 1000111,
    "LOVAS 2"                             => 1000112,
    "URATA-NIIJIMA"                       => 1000113,
    "WISEMAN-SKIFF"                       => 1000114,
    "HELIN"                               => 1000115,
    "MUELLER"                             => 1000116,
    "SHOEMAKER-HOLT 1"                    => 1000117,
    "HELIN-ROMAN-CROCKETT"                => 1000118,
    "HARTLEY 3"                           => 1000119,
    "PARKER-HARTLEY"                      => 1000120,
    "HELIN-ROMAN-ALU 1"                   => 1000121,
    "WILD 4"                              => 1000122,
    "MUELLER 2"                           => 1000123,
    "MUELLER 3"                           => 1000124,
    "SHOEMAKER-LEVY 1"                    => 1000125,
    "SHOEMAKER-LEVY 2"                    => 1000126,
    "HOLT-OLMSTEAD"                       => 1000127,
    "METCALF-BREWINGTON"                  => 1000128,
    "LEVY"                                => 1000129,
    "SHOEMAKER-LEVY 9"                    => 1000130,
    "HYAKUTAKE"                           => 1000131,
    "HALE-BOPP"                           => 1000132,
    "C/2013 A1"                           => 1003228,
    "SIDING SPRING"                       => 1003228,
    "GASPRA"            => 9511010,
    "IDA"               => 2431010,
    "DACTYL"            => 2431011,
    "CERES"             => 2000001,
    "PALLAS"            => 2000002,
    "VESTA"             => 2000004,
    "LUTETIA"           => 2000021,
    "KLEOPATRA"         => 2000216,
    "EROS"              => 2000433,
    "DAVIDA"            => 2000511,
    "MATHILDE"          => 2000253,
    "STEINS"            => 2002867,
    "1992KD"            => 2009969,
    "BRAILLE"           => 2009969,
    "WILSON-HARRINGTON" => 2004015,
    "TOUTATIS"          => 2004179,
    "ITOKAWA"           => 2025143,
    "NOTO"       => 398989,
    "NEW NORCIA" => 398990,
    "GOLDSTONE"  => 399001,
    "CANBERRA"   => 399002,
    "MADRID"     => 399003,
    "USUDA"      => 399004,
    "DSS-05"     => 399005,
    "PARKES"     => 399005,
    "DSS-12"     => 399012,
    "DSS-13"     => 399013,
    "DSS-14"     => 399014,
    "DSS-15"     => 399015,
    "DSS-16"     => 399016,
    "DSS-17"     => 399017,
    "DSS-23"     => 399023,
    "DSS-24"     => 399024,
    "DSS-25"     => 399025,
    "DSS-26"     => 399026,
    "DSS-27"     => 399027,
    "DSS-28"     => 399028,
    "DSS-33"     => 399033,
    "DSS-34"     => 399034,
    "DSS-42"     => 399042,
    "DSS-43"     => 399043,
    "DSS-45"     => 399045,
    "DSS-46"     => 399046,
    "DSS-49"     => 399049,
    "DSS-53"     => 399053,
    "DSS-54"     => 399054,
    "DSS-55"     => 399055,
    "DSS-61"     => 399061,
    "DSS-63"     => 399063,
    "DSS-64"     => 399064,
    "DSS-65"     => 399065,
    "DSS-66"     => 399066,
)

function naifid(str::AbstractString)
    NAIF_IDS[uppercase(str)]
end

function name_from_naifid(searchid::Int)
    if searchid == 0
        return "SOLAR SYSTEM BARYCENTER"
    elseif searchid == 3
        return "EARTH-MOON BARYCENTER"
    end
    for (name, id) in NAIF_IDS
        if searchid == id && !contains(name, "_")
            return name
        end
    end
end
